/**
 * 上海中赢金融信息服务有限公司
 * Copyright (c) 2016-2026 hmc,Inc.All Rights Reserved.
 */
package com.sys.kafka.config;

/**
 * Img配置本地线程变量
 * <b>ClassName：</b> BHBaseConfigHolder <br/>
 * <b>Description：</b> TODO <br/>
 * <b>@author：</b> mobing <br/>
 * <b>@date：</b> 2015年10月26日 下午3:41:52 <br/>
 * <b>@version: </b>  <br/>
 */
public abstract class KafkaConfigHolder {

    private static ThreadLocal<KafkaConfig> local = new ThreadLocal<KafkaConfig>();

    private static KafkaConfig config;
    public static void put(KafkaConfig newNode) {
        if (newNode != null) {
            KafkaConfig oldNode = local.get();
            if (oldNode != newNode) {
                local.remove();
                local.set(newNode);
                config= newNode;
            }
        }
    }

    public static KafkaConfig get() {
        
        if(local.get()==null){
           return config;
        }
        return local.get();
    }

    public static void remove() {
        local.remove();
    }

}